// ELbpRecognizer.h: interface for the ELbpRecognizer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ELBPRECOGNIZER_H__B286E577_C8ED_4690_A19F_A8B31897F2AE__INCLUDED_)
#define AFX_ELBPRECOGNIZER_H__B286E577_C8ED_4690_A19F_A8B31897F2AE__INCLUDED_

#include <fstream>
#include <strstream>
#include <algorithm>
#include <bitset>

using namespace std;

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#define IMAGE_HEIGHT 142
#define IMAGE_WIDTH 120
#define TOTAL_FILTERS 10
#define BINS_OF_UNIFORM_FEA 63

//typedef unsigned char BYTE;

struct Feature {
	int feaId;
	int filterID;
	int filterSize;
	int subWinSize;
	int row, col;	//location of top-left;
	int binID;	
	
	double threshold;
	double lval;
	double rval;
};
struct StageClassifier {
	int totalWCs;
	double stageThr;
	double maxScore;
	double minScore;
	
	Feature *fea;
};
struct ElbpModel {
	int totalStages;
	int totalFeatures;

	StageClassifier *SC;
};

class ELbpRecognizer  
{
public:
	ELbpRecognizer();
	virtual ~ELbpRecognizer();

private:
	void Integal(unsigned char *pImg);
	bool LoadModel(const char *modelFile);
	bool LoadModelFromRes(const char *ModelRes);
	void ELBPFilter();
public:
	bool Init(const char* lpszModelFile,int nLoadType);
	bool UnInit(); 
	double CompareTwoFeatures(unsigned char *pFea1, unsigned char *pFea2);
	BYTE* GetFeatures(unsigned char *pImg);
	int GetFeatureSize();


private:
	unsigned char *feaVector;
	int **intImg;
	unsigned char ***pFImg;
	ElbpModel m_Model;

};

#endif // !defined(AFX_ELBPRECOGNIZER_H__B286E577_C8ED_4690_A19F_A8B31897F2AE__INCLUDED_)
